package 排序;

import java.util.Arrays;

public class MaopaoSort {

    public static void main(String[] args) {
        // 冒泡排序
        int[] arr = new int[]{2,4,1,6,3,6,7};
        int n = arr.length;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n - i - 1; j++) {
                if(arr[j] > arr[j+1]){
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
            Arrays.stream(arr).forEach(c -> System.out.print(c + "  "));
            System.out.println();
        }
    }
}
